/*
Title: Smedia Javascript collections
Revision: 2/25/2005 22:15
URI: http://www.smedia.or.id
*/

function popsalute(urin) {
	winpopup(urin,'saluted',540,375,0,0,0,1,0,1,0);
}


function winpopup(popurl,winname,W,H,tbr,loc,dir,sta,mnu,sbr,rez) {
	if (tbr==1) { togtbr = "toolbar=yes" } else { togtbr = "toolbar=no" }
	if (loc==1) { togloc = "location=yes" } else { togloc = "location=no" }
	if (dir==1) { togdir = "directories=yes" } else { togdir = "directories=no" }
	if (sta==1) { togsta = "status=yes" } else { togsta = "status=no" }
	if (mnu==1) { togmnu = "menubar=yes" } else { togmnu = "menubar=no" }
	if (sbr==1) { togsbr = "scrollbars=yes" } else { togsbr = "scrollbars=no" }
	if (rez==1) { togrez = "resizable" } else { togrez = "" }
	var attribute = togtbr +','+ togloc +','+ togdir +','+ togsta +','+ 'width='+ W + ',height=' + H +','+ togmnu +','+ togsbr +','+ togrez
	window.open(popurl, winname, attribute);
}

/* ----------- */
/* Query Sting */
/* ----------- */

function getQueryVariable(variable) {
 	var query = window.location.search.substring(1)
 	if ( query != null ) { var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } }
}

/* --------- */
/* cookies */
/* --------- */

function createCookie(name,value,days) {
	if (days) {
		var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "="; var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) { createCookie(name,"",-1); }


